﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Cole.Entities;
using Cole.Service;

namespace Cole.GUI.Grado_Seccion
{
    public partial class FrmEditarGrado_Seccion : Form
    {
        private IGradoBl gradoBl;
        public FrmEditarGrado_Seccion()
        {
            InitializeComponent();
            if (gradoBl == null)
            {
                gradoBl = new GradoBl();
            }
        }

        private void FrmEditarGrado_Seccion_Load(object sender, EventArgs e)
        {

        }
        public void Recibir(GradoSeccion grado) 
        {
            gradoSeccionBindingSource.DataSource = grado;
        }

        private void btnGuardar_Click(object sender, EventArgs e)
        {
            var gradoActual = gradoSeccionBindingSource.Current as GradoSeccion;
            if (gradoActual != null)
            {
                gradoBl.ModificarGrado(gradoActual);
                Close();
            }
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Close();
        }

    }
}
